package com.wangjiang.foundation.mybatis.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;


/**
 * 公用基础实体类父类
 */
@Data
public class BaseEntity implements Serializable  {
//    @TableField(value = "id")
//    private Long id;
    @TableId(value = "uuid",type = IdType.UUID)//指定uuid
    @JsonSerialize(using= ToStringSerializer.class)
    private String uuid;

    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @TableField(value = "created_by_id")
    private String createdById;

    @TableField(value = "created_by_name")
    private String createdByName;

    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @TableField(value = "updated_by_id")
    private String updatedById;

    @TableField(value = "updated_by_name")
    private String updatedByName;

    // 逻辑删除字段
    @TableField(value = "del_flag")
    @TableLogic
    private Boolean delFlag;

    // 启用停用
    @TableField(value = "status")
    private Boolean status;

    // description
    @TableField(value = "description")
    private String description;

    // remark
    @TableField(value = "remark")
    private String remark;
}
